@extends('admin.mainlayout')
@section('title')
    <div class="title"><span id="test">会员管理</span></div>
    <br/>
    <div class="main_top" >
        <form id='search' action="{{url('center/member')}}" method="get">
            <span>选择时间段</span>
            <input type="text" name="starttime" class="laydate-icon" id="hello2"/><span> -</span>
            <input type="text" name="endtime" class="laydate-icon" id="hello3"/>
            <input type="text" name="keyword" style="width: 120px;height: 21px;margin-left: 100px" placeholder="手机号/昵称"/>
            <span id="sousuo" >搜索</span>
        </form>
    </div>
    <style type="text/css">
        #sousuo{
            display:inline-block;
            background: #347c1e;
            text-align: center;
            color:white;
            height:25px;
            width:40px;
            margin-left: 40px;
            cursor: pointer;
        }
        #sousuo:hover{
            background-color: #2d94e8;
        }
    </style>
@endsection

@section('content')
        <!-- start 充值订单管理-->
    <div class="list1">
        <table id="kuxuan">
            <tr>
                <th>id</th>
                <th>手机号</th>
                <th>用户名</th>
                <th>昵称</th>
                <th>身份证号</th>
                <th>邮箱</th>
                <th>用户edu金额</th>
                <th>用户edu冻结金额</th>
                <th>ip</th>
                <th>创建时间</th>
                {{--<th>操作</th>--}}
            </tr>

            @if(!empty($data['data']))
                @foreach($data['data'] as $v)
            <tr>
                <td>{{$v['id']}}</td>
                <td>{{$v['member_mobile']}}</td>
                <td>{{$v['member_name']}}</td>
                <td>{{$v['pet_name']}}</td>
                <td>{{$v['card']}}</td>
                <td>{{$v['member_email']}}</td>
                <td>{{$v['edu_amount']}}</td>
                <td>{{$v['edu_freeze_amount']}}</td>
                <td>{{$v['ip']}}</td>
                <td style="color: black;cursor: default">{{$v['updated_at']}}</td>
                {{--<td id="queren" onclick="queren({{$v['id']}})">待定</td>--}}
            </tr>
                @endforeach
             @else
                <tr>
                    <td colspan="9">暂无数据(﹀_﹀")......</td>
                </tr>
            @endif
        </table>
    </div>

    <div class="del">
        <div class="bot">
            @if(!empty($data['pageNoList']))
            @if($data['prev_page_url'])
                <p class="prev"><a href="{{$data['prev_page_url']}}@if(!empty($_GET['starttime']))&starttime={{$_GET['starttime']}}@endif @if(!empty($_GET['endtime']))&endtime={{$_GET['endtime']}}@endif @if(!empty($_GET['keyword']))&keyword={{$_GET['keyword']}}@endif"><span class="jiazai">上一页</span></a></p>
            @endif
            <ul>
                @foreach($data['pageNoList'] as $v)
                    <li @if($data['current_page'] ==  $v )class="active_list" @endif ><span class="jiazai"><a href="/center/member?page={{$v}}@if(!empty($_GET['starttime']))&starttime={{$_GET['starttime']}}@endif @if(!empty($_GET['endtime']))&endtime={{$_GET['endtime']}}@endif @if(!empty($_GET['keyword']))&keyword={{$_GET['keyword']}}@endif">{{$v}}</a></span></li>
                @endforeach
            </ul>
            @if($data['next_page_url'])
                <p class="next"><a href="{{$data['next_page_url']}}@if(!empty($_GET['starttime']))&starttime={{$_GET['starttime']}}@endif @if(!empty($_GET['endtime']))&endtime={{$_GET['endtime']}}@endif @if(!empty($_GET['keyword']))&keyword={{$_GET['keyword']}}@endif"><span class="jiazai">下一页</span></a></p>
            @endif
                @endif
        </div>

    </div>
    <script>

        //点击发送ajax请求,改变状态
        function queren(id){


                layer.confirm('确认到账?',{btn:['确定','取消']},function(){
                    console.log(id);
                    $.ajax({
                        type:'post',
                        url:'{{url('center/order/change')}}',
                        dataType:'json',
                        data:{'_token':"{{csrf_token()}}",'id':id},
                        success:function(res){

                            if(res['status']==1){

                                layer.msg(res.msg,{icon:6});
                                setTimeout("location.reload()",1500);


                            }else{

                                layer.msg(res.msg,{icon:5});

                            }

                        }
                    });

                },function(){


                });



        }

        //时间搜索
        var oSousuo = document.getElementById('sousuo');
        var oSearch = document.getElementById('search');

        oSousuo.onclick = function(){
            //加载效果
            layer.load(2, {shade: false});
            oSearch.submit();

        }

        laydate({
            elem: '#hello2'
        });
        laydate({
            elem: '#hello3'
        });

    </script>


@endsection
